Test Case Modeling
Select the project name in the Project view or click on States. Select View|Show View|Content. The default automaton is displayed in the Content view.
This automaton contains an initial node with a transition to the state named Testlet. After the state, a transition leads to the final node. States are called testlets in TPT. A testlet can be varied. The appropriate testlet variant is selected in a so-called time partition test case. Right-click on the Test Cases folder and select Add Test Case (Time Partition).
Double-click on Testlet in the Content view. The default testlet variant is automatically selected in the Project view. In the Content view, the default automaton disappears and the Content view changes its toolbar.
Rename the default testlet variant to ON_OFF to describe that we want to check the behavior when switching the light on and off. Right-click on the testlet variant and select Rename.
Click Add step in the Content view toolbar or press F4 to display the different steps available. Select Channel [S] or press S to insert a Channel step.
Enter light_switch
into the first field. The autocompletion feature (shortcut Ctrl+Space) can be used to insert signal names. They can also be copied from the Declaration Editor (shortcut Ctrl+ ALT+C), see Declaration Editor.
Add ON_MODE in the second field. Change Always to ONCE to set light_switch
only in the first sample point to ON_MODE.
Sample point
A sample point is a specific signal value at a specific time.
Click Add step in the Content view toolbar or press F4 to display the different steps available. Select Wait [W] or press W to insert a Wait step. Add 5 s to the Wait step. This results in a duration of 5 s for the step(s) before the Wait step.
Select the first two steps and copy them by using Shift and click for multiple selection and using Ctrl+C and Ctrl+V. After copying, change the value field of the second Channel step to 0.
To check if the headlight is on when light_switch
is set to ON_MODE, select line 1. Click Add step and select Compare [C] or use F4 followed by C alternatively.
In the Compare step, add headlight
and set the value to true. Select Always for the duration of the check since we want to check headlight being on all the time light_switch
is set to ON_MODE.
A given statement of the Compare step needs to be true only once (Exists), always (Always), at the first sample point (First), or at the last sample point (Last).